package cn.edu.zafu.bigdata.lyq.work9;
import java.io.*;
import java.net.*;

public class TCPClient {
    public static void main(String[] args) {
        try{
            Socket socket = new Socket("10.205.109.50",9990);
            PrintWriter out = new PrintWriter(socket.getOutputStream());
            BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            BufferedReader sin = new BufferedReader(new InputStreamReader(System.in));
            String s;
            do{
                s=sin.readLine();
                out.println(s);
                out.flush();
                if(!s.equals("bye")){
                    System.out.println("服务器回复："+in.readLine());
                }else{
                    System.out.println("通信结束！");
                }
            }while(!s.equals("bye"));
            out.close();;
            in.close();
            socket.close();}catch (Exception e){
            System.out.println("Error:" +e);

        }
    }
}
